// 引入
import * as dd from "dingtalk-jsapi";
import wx from "weixin-js-sdk";

/* 钉钉环境 ---------------------------------------------------------------- */
// 判断是不是钉钉环境的方法
export const isDingtalkEnv = () => {
  return dd.env.platform == "notInDingTalk" ? false : true;
};

/* 微信环境 ---------------------------------------------------------------- */
export const isWxWorkEnv = () => {
  let env = "";
  let ua = window.navigator.userAgent.toLowerCase();
  // console.log(ua);
  if (ua.indexOf("micromessenger") != -1) {
    if (ua.indexOf("wxwork") != -1) {
      // 企业微信
      env = "wxwork";
    } else {
      // 微信
      env = "wx";
    }
  } else {
    // 非微信
    env = "notWx";
  }
  return env;
};
